package service;

import javax.jms.JMSException;

import newspaper.VnexpressThreadManager;

public class ActiveMQManager {
	public static void main(String[] args) {
		start();
	}
	
	public static void start() {
		VnexpressMessageReceiver receiver = new VnexpressMessageReceiver();
		try {
			receiver.getMessage();
		} catch (JMSException e) {
			e.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		VnexpressMessageSeller sender = new VnexpressMessageSeller();
		sender.start();
		VnexpressThreadManager.initAll();
		VnexpressThreadManager.sender = sender;
		VnexpressThreadManager.started = true;
		System.out.println("ActiveMQ started !"); 
	}
	
	public static void stop() {
		System.out.println("Stop ActiveMQ, stopping threads !"); 
		VnexpressThreadManager.stopAll();
	}
}
